package day05;
import javax.naming.MalformedLinkException;
import java.util.Arrays;
public class ArrayDemo {
    public static void main(String[] args) {
        int[]arr=new int[10];
        for (int i=0;i< arr.length;i++){
            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }
        Arrays.sort(arr);
        System.out.println("排序后");
        for (int i=0;i< arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("降序后");
        for (int i= arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }











        /*
        int[]arr= new int[10];
        for (int i=0;i<arr.length;i++){
            arr[i]=(int) (Math.random()*100);
            System.out.println(arr[i]);
        }
        Arrays.sort(arr);
        System.out.println("排序后");
        for (int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("倒序后");
        for (int i=arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }

         */











        /*
        int[] arr=new int[1000];
        for (int i=0;i<arr.length;i++){

            arr[i]=(int)(Math.random()*100);
            System.out.println(arr[i]);
        }

         */








        /*
        int[] a = new int[5];
        a[0]=1;
        a[1]=2;
        a[2]=3;
        a[3]=100;
        a[4]=200;
        System.out.println(a[a.length-1]);//输出最后一个元素
        System.out.println(a[2]);//输出第三个元素
        System.out.println(a.length);//输出数组长度


         */










        /*
        double[] d=new double[10];
        boolean[] b=new boolean[26];
        //数组的初始化
        int[] arr1=new int[3];
        int[] arr2=new int[]{2,5,9};
        int[] arr3={2,5,9};
        int[] arr4;
        arr4=new int[]{2,5,8};
        int[] q=new int[6];
        int[] w=new int[]{2,1,4,5,7,8};
        int[] e={1,2,3,};
        boolean[] p={true,false,true};
        double[] x;
        x=new double[]{1.2,2.5,1.33};

         */

    }
}
